package model;

import java.util.ArrayList;
import java.util.List;
import java.sql.ResultSet;
import java.sql.SQLException;

public class VUser {
	private String userid;
	private String nickname;
	private String pwd;
	private int usertype;
	
	private String usertypename;
	
	private String realname;
	private int userphoto;
	private String photoname;
	private String signed;
	private String agend;
	private String birthday;
	private String mobile;
	private String pid;
	private String logintime;
	private String loginaddr;
	private String createtime;
	private int anthority;
	private int articlecounter;
	private boolean isdelete;
	
	
	public VUser(){
		
	}
	
	public VUser(ResultSet rs){
		try {
			if(rs!=null && rs.next()){
				this.userid = rs.getString("userid");
				this.nickname = rs.getString("nickname");
				this.pwd = rs.getString("pwd");
				this.usertype = rs.getInt("usertype");
				this.usertypename = rs.getString("usertypename");
				this.realname = rs.getString("realname");
				this.userphoto = rs.getInt("userphoto");
				this.signed = rs.getString("signed");
				this.agend = rs.getString("agend");
				this.birthday = rs.getString("birthday");
				this.mobile = rs.getString("mobile");
				this.pid = rs.getString("pid");
				this.logintime = rs.getString("logintime");
				this.loginaddr = rs.getString("loginaddr");
				this.createtime = rs.getString("createtime");
				this.anthority = rs.getInt("anthority");
				this.articlecounter = rs.getInt("articlecounter");
				this.isdelete = rs.getBoolean("isdelete");				
				this.photoname = rs.getString("photoname");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static List<VUser> toList(ResultSet rs){
		List<VUser> list = new ArrayList<VUser>();
		if(rs!=null)
		{
			try {
				while (rs.next()) {
					VUser user = new VUser();
					user.userid = rs.getString("userid");
					user.nickname = rs.getString("nickname");
					user.pwd = rs.getString("pwd");
					user.usertype = rs.getInt("usertype");
					user.usertypename = rs.getString("usertypename");
					user.realname = rs.getString("realname");
					user.userphoto = rs.getInt("userphoto");
					user.signed = rs.getString("signed");
					user.agend = rs.getString("agend");
					user.birthday = rs.getString("birthday");
					user.mobile = rs.getString("mobile");
					user.pid = rs.getString("pid");
					user.logintime = rs.getString("logintime");
					user.loginaddr = rs.getString("loginaddr");
					user.createtime = rs.getString("createtime");
					user.anthority = rs.getInt("anthority");
					user.articlecounter = rs.getInt("articlecounter");
					user.isdelete = rs.getBoolean("isdelete");				
					user.photoname = rs.getString("photoname");
					list.add(user);
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return list;
		
	}


	public VUser(String userid, String nickname, String pwd, int usertype,
			String usertypename, String realname, int userphoto,
			String photoname, String signed, String agend, String birthday,
			String mobile, String pid, String logintime, String loginaddr,
			String createtime, int anthority, int articlecounter, boolean isdelete) {
		super();
		this.userid = userid;
		this.nickname = nickname;
		this.pwd = pwd;
		this.usertype = usertype;
		this.usertypename = usertypename;
		this.realname = realname;
		this.userphoto = userphoto;
		this.photoname = photoname;
		this.signed = signed;
		this.agend = agend;
		this.birthday = birthday;
		this.mobile = mobile;
		this.pid = pid;
		this.logintime = logintime;
		this.loginaddr = loginaddr;
		this.createtime = createtime;
		this.anthority = anthority;
		this.articlecounter = articlecounter;
		this.isdelete = isdelete;
	}


	public String getUserid() {
		return userid;
	}


	public void setUserid(String userid) {
		this.userid = userid;
	}


	public String getNickname() {
		return nickname;
	}


	public void setNickname(String nickname) {
		this.nickname = nickname;
	}


	public String getPwd() {
		return pwd;
	}


	public void setPwd(String pwd) {
		this.pwd = pwd;
	}


	public int getUsertype() {
		return usertype;
	}


	public void setUsertype(int usertype) {
		this.usertype = usertype;
	}


	public String getUsertypename() {
		return usertypename;
	}


	public void setUsertypename(String usertypename) {
		this.usertypename = usertypename;
	}


	public String getRealname() {
		return realname;
	}


	public void setRealname(String realname) {
		this.realname = realname;
	}


	public int getUserphoto() {
		return userphoto;
	}


	public void setUserphoto(int userphoto) {
		this.userphoto = userphoto;
	}


	public String getPhotoname() {
		return photoname;
	}


	public void setPhotoname(String photoname) {
		this.photoname = photoname;
	}


	public String getSigned() {
		return signed;
	}


	public void setSigned(String signed) {
		this.signed = signed;
	}


	public String getAgend() {
		return agend;
	}


	public void setAgend(String agend) {
		this.agend = agend;
	}


	public String getBirthday() {
		return birthday;
	}


	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}


	public String getMobile() {
		return mobile;
	}


	public void setMobile(String mobile) {
		this.mobile = mobile;
	}


	public String getPid() {
		return pid;
	}


	public void setPid(String pid) {
		this.pid = pid;
	}


	public String getLogintime() {
		return logintime;
	}


	public void setLogintime(String logintime) {
		this.logintime = logintime;
	}


	public String getLoginaddr() {
		return loginaddr;
	}


	public void setLoginaddr(String loginaddr) {
		this.loginaddr = loginaddr;
	}


	public String getCreatetime() {
		return createtime;
	}


	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}


	public int getAnthority() {
		return anthority;
	}


	public void setAnthority(int anthority) {
		this.anthority = anthority;
	}


	public int getArticlecounter() {
		return articlecounter;
	}


	public void setArticlecounter(int articlecounter) {
		this.articlecounter = articlecounter;
	}

	public boolean isIsdelete() {
		return isdelete;
	}

	public void setIsdelete(boolean isdelete) {
		this.isdelete = isdelete;
	}


	
	
	
	
	
	
}
